package Text12;
import java.util.*;
public class Main{

    public static void get_divisors(int x){
        ArrayList<Integer> arrayList = new ArrayList<>();
        for(int i = 1 ; i <= x / i ; i ++ ){
            if(x%i==0){
                arrayList.add(i);
                if(i!=x/i){
                    arrayList.add(x/i);
                }
            }
        }
        Collections.sort(arrayList);
        for(int a : arrayList){
            System.out.print(a + " ");
        }
        System.out.println();
    }
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        while (n-->0){
            int x = scanner.nextInt();
            get_divisors(x);
        }
    }
}

